from django.urls import path, include
from common import views
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register(prefix="viewset/custom_user_info_list", viewset=views.CustomUserViewSet)

urlpatterns = [
    # Generic Class Based View
    # path("fbv/custom_user_info_list/", views.CustomUserList.as_view(), name="用户信息列表"),
    # path("fbv/custom_user_info_list/<int:pk>", views.CusomUserDetail.as_view(), name="用户信息列表-详情"),
    # 使用视图集编程 Viewset（写法一）
    # path("viewset/custom_user_info_list/", views.CustomUserViewSet.as_view({"get": "list", "post": "create"}), name="用户信息列表"),
    # path("viewset/custom_user_info_list/<int:pk>", views.CustomUserViewSet.as_view({"get": "retrieve", "put": "update", "patch": "partial_update", "delete": "destroy"}), name="用户信息列表-详情"),
    # 使用视图集编程 Viewset（写法二）
    # path("",include(router.urls))
    path("register/", views.RegisterView.as_view(), name="register"),
    # JWT登录认证
    path("jwt/login/", views.JwtLoginView.as_view()),
    # 通过JWT认证请求接口
    path("jwt/order/", views.JwtOrderView.as_view()),
    # 前端获取的动态路由接口
    path("jwt/get-async-routes/", views.AsyncRoutesView.as_view()),
    # 刷新Token接口
    path("jwt/refresh-token/", views.RefreshTokenView.as_view()),
]
# 使用视图集编程 Viewset（写法三）
urlpatterns += router.urls
